home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
223_01
/
strncpy.c
< prev
next >
Wrap
Text File
|
1980-01-01
|
512b
|
15 lines
/*
** copy n characters from sour to dest (null padding)
*/
static char *xd;
strncpy(dest, sour, n) char *dest, *sour; int n; {
xd = dest;
while(n-- > 0) {
if(*xd++ = *sour++) continue;
while(n-- > 0) *xd++ = 0;
}
*xd = 0;
return (dest);
}